<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<style type="text/css">
.dateWidth1{
   width:195px;
}
.select_width{
   width:130px;
}
</style>
<x:parse xml="${param.xmlstr}" var="xmlData" />
<input type="hidden" name="organizations/organization[0]/sequence_no" value="1" >
<input type="hidden" name="organizations/organization[0]@submit_org" value="1" >
<input type="hidden" name="organizations/organization[0]/org_code" value="<x:out select="$xmlData/data/organizations/organization[@submit_org=1]/org_code"/>" >
<table class="t_css" width="100%" border="0" cellpadding="0" id="basicInfo" cellspacing="1" style="table-layout:fixed;">
	<col width="10%;">
	<col width="15%;">
	<col width="30%;">
	<col width="15%;">
	<col width="30%;">
	<tr> 
		<td   colspan="5" class="t_bar2">基本信息</td>
	</tr>
	<tr>
		<td  align="right" colspan="2"><span class="color_red">*</span>成果名称：</td>
		<td  colspan="3">
			<input name="proposal/zh_title" label="成果名称" type="text" required class="input_css required "  style="width: 680px;" maxlength="60" value="<x:out select="$xmlData/data/proposal/zh_title" />"/> 
		</td>
	</tr>
	<tr>
	   <td  align="right" colspan="2"><span class="color_red">*</span>研究起始时间：</td>
		<td >
			<c:set var="start_date"><x:out select="$xmlData/data/proposal/start_date" /></c:set>
			<cpt:date id="start_date" name="proposal/start_date" value="${start_date}" className=" required date  dateCompare:end_date" label="研究起始时间" ></cpt:date> 
		</td>
		<td  align="right" ><span class="color_red">*</span>研究终止时间：</td>
		<td >
			<c:set var="end_date"><x:out select="$xmlData/data/proposal/end_date" /></c:set>
			<cpt:date id="end_date" name="proposal/end_date" className=" required date" label="研究终止时间"  value="${end_date}" ></cpt:date> 
		</td>
	</tr>
	<tr>
		<td  align="center" rowspan="6">申请鉴定单位</td>
		<td  align="right" >单位名称：</td>
		<td   colspan="3">
			<span name="organizations/organization[0]/org_name"> 
				<x:out select="$xmlData/data/organizations/organization[@submit_org=1]/org_name" />
			</span>
		</td>
	</tr>
	<tr>
		<td  align="right" ><span class="color_red">*</span>隶属省部：</td>
		<td  colspan="3">
			<input name="proposal/parent_department" id="parent_department" label="隶属省部" type="text" required class="input_css required "   style="width: 680px;"  maxlength="60" value="<x:out select="$xmlData/data/proposal/parent_department" />"/>
		</td>
	</tr>
	<tr>
		<td  align="right" >注册地区：</td>
		<td >
			<span name="organizations/organization[0]/area_name">
				<x:out select="$xmlData/data/organizations/organization[@submit_org=1]/area_name" />
			</span>
		</td>
		<td  align="right" ><span class="color_red">*</span>单位属性：</td>
		<td >
			<c:set var="orgtype"><x:out select="$xmlData/data/proposal/orgtype_value" /></c:set>
			<cpt:select id="orgtype"   key="orgtype"  value="${orgtype}" onChange="initControlValue(this.id);setOrgType();" style="width:200px;"></cpt:select>
			<input type="hidden" id="orgtype_value" name="proposal/orgtype_value" class="required" value="${orgtype}" label="单位属性">
			<input type="hidden" id="orgtype_name" name="proposal/orgtype_name" value="<x:out select="$xmlData/data/proposal/orgtype_name" />">
		</td>
	</tr>
	<tr>
		<td  align="right" >项目负责人：</td>
		<td  >
			<span name="proposal/fzr_psnname" ><x:out select="$xmlData/data/zh_persons/zh_person[@submit_psn='1']/basic_info/zh_name" /></span>
		</td>
		<td  align="right" >邮政编码：</td>
		<td  >
			<span name="organizations/organization[0]/zip_code">
				<x:out select="$xmlData/data/organizations/organization[@submit_org=1]/zip_code" />
		     </span>
		</td>
	</tr>
	<tr>
		<td  align="right" >单位电话：</td>
		<td  >
			 <span name="organizations/organization[0]/org_tel">
				<x:out select="$xmlData/data/organizations/organization[@submit_org=1]/org_tel" />
		     </span>
		</td>
		<td  align="right" >个人电话：</td>
		<td  >
			<span name="proposal/mobile" class="person"><x:out select="$xmlData/data/zh_persons/zh_person[@submit_psn='1']/contact/mobile" /></span>
		</td>
	</tr>
	<tr>
		<td  align="right" >单位地址：</td>
		<td  colspan="3">
			 <span name="organizations/organization[0]/address">
				<x:out select="$xmlData/data/organizations/organization[@submit_org=1]/address" />
		     </span>
		</td>
	</tr>
	<tr>
		<td align="right" colspan="2"><span class="color_red">*</span>任务来源：</td>
		<td colspan="3">
			<cpt:checkbox key="task_resource" name="task_resource" repeatColumn="3" tagType="checkBox"  onClick="controlAccept();" ></cpt:checkbox>
			<input type="hidden" id="task_resource" name="proposal/task_resource_value" class="required" label="任务来源" value="<x:out select="$xmlData/data/proposal/task_resource_value" />" label="任务来源">
			<input type="hidden" name="proposal/task_resource_name" value="<x:out select="$xmlData/data/proposal/task_resource_name" />">
		</td>
	</tr>
	<tr>
		<td align="right" colspan="2"><span class="color_red">*</span>验收情况：</td>
		<td colspan="3">
			<cpt:checkbox key="accept_situation" name="accept_situation" repeatColumn="4" tagType="radio" ></cpt:checkbox>
			<input type="hidden" id="accept_situation" name="proposal/accept_situation_value" class="required" label="验收情况" value="<x:out select="$xmlData/data/proposal/accept_situation_value" />" label="验收情况">
			<input type="hidden" name="proposal/accept_situation_name" value="<x:out select="$xmlData/data/proposal/accept_situation_name" />">
		</td>
	</tr>
	<tr>
		<td align="right" colspan="2"><span class="color_red">*</span>成果有无密级：</td>
		<td  >
			<cpt:checkbox key="whether2" name="whether2" repeatColumn="2" tagType="radio"  onClick="controlSecret();"></cpt:checkbox>
			<input type="hidden" id="whether" name="proposal/whether2_value" class="required"label="成果有无密级" value="<x:out select="$xmlData/data/proposal/whether2_value" />" label="成果有无密级">
			<input type="hidden" name="proposal/whether2_name" value="<x:out select="$xmlData/data/proposal/whether2_name" />">
		</td>
		<td align="right" ><span class="color_red">*</span>密级：</td>
		<td  >
			<cpt:checkbox key="secret_level2" name="secret_level2" repeatColumn="3" tagType="radio" ></cpt:checkbox>
			<input type="hidden" id="secret_level2" name="proposal/secret_level2_value" class="required"label="密级" value="<x:out select="$xmlData/data/proposal/secret_level2_value" />" label="密级">
			<input type="hidden" name="proposal/secret_level2_name" value="<x:out select="$xmlData/data/proposal/secret_level2_name" />">
		</td>
	</tr>
	<tr>
		<td align="right" colspan="2"><span class="color_red">*</span>归口管理部门：</td>
		<td colspan="3">
		<%-- 	<c:set var="recomend_org"><x:out select="$xmlData/data/proposal/recomend_org_value" /></c:set>
			<c:set var="sqOrgCode"><x:out select="$xmlData/data/organizations/organization[@submit_org=1]/org_code"/></c:set>
			<cpt:select id="recomend_org" sqlParamVal="{currentorgcode:${sqOrgCode }}"  key="proposal_tjbm"  value="${recomend_org}" onChange="initControlValue(this.id);" style="width:200px;"></cpt:select>
			<input type="hidden" id="recomend_org_value" name="proposal/recomend_org_value" class="required" value="${recomend_org}" label="归口管理部门">
			<input type="hidden" name="proposal/recomend_org_name" value="<x:out select="$xmlData/data/proposal/recomend_org_name" />">
		 --%>
		<c:set var="recomend_org">
		{'id':'<x:out select="$xmlData/data/proposal/recomend_org_value" />',
		'name':'<x:out select="$xmlData/data/proposal/recomend_org_name" />'
		}					
		</c:set> <cpt:tree id="recomend_org" key="recommended"
				cacheable="false" className="hn_iuput_kuang required selectWidth3"
				readonly="true" value="${recomend_org}" label="归口管理部门"
				showPattern="all" shieldPattern="0"
				onClick="initTreeValue2_qhh">
			</cpt:tree> <input type="hidden" name="proposal/recomend_org_value"
			value="<x:out select="$xmlData/data/proposal/recomend_org_value" />" />
			<input type="hidden" name="proposal/recomend_org_name"
			value="<x:out select="$xmlData/data/proposal/recomend_org_name" />" />
		
		</td>
	</tr>

</table>


<script type="text/javascript">
$(function(){
	$("#parent_department").blur(function(){
	     $("#indepart").text($("#parent_department").val());
	   });
	
	setOrgType();
});

function percentage(id1,id2,id3){
	var val1 = $("#"+id1).val();
	var val2 = $("#"+id2).val();
	$("#"+id3).text(formatVal(val2*100/val1)+"%");
	
}


function controlAccept(){
	var task_resource = $("#task_resource").val();
	
	if(task_resource.indexOf("01") != -1 || task_resource.indexOf("02") != -1){
		$("#accept_situation").parent().prev().html("<span class='color_red'>*</span>验收情况：");
		$("input[name='accept_situation']").attr("disabled",false);
		$("#accept_situation").addClass("required");
		$("#berif_his1113").parent().prev().html("<span id='berif1113' name='content/content[06]/berif'>是</span>");
		$("#berif_his1114").parent().prev().html("<span id='berif1114' name='content/content[06]/berif'>是</span>");
	}else{
		$("input[name='accept_situation']").attr("checked",false);
		$("input[name='accept_situation']").attr("disabled",true);
		$("#accept_situation").val("");
		$("#accept_situation").removeClass("required");
		$("#accept_situation").parent().prev().html("验收情况：");
		$("#berif_his1113").parent().prev().html("<span id='berif1113' name='content/content[06]/berif'>否</span>");
		$("#berif_his1114").parent().prev().html("<span id='berif1114' name='content/content[06]/berif'>否</span>");
	}
}

function controlSecret(){
	var whether = $("#whether").val();
	
	if(whether == '1'){
		$("#secret_level2").parent().prev().html("<span class='color_red'>*</span>密级：");
		$("#secret_level2").addClass("required");
		$("input[name='secret_level2']").attr("disabled",false);
	}else{
		$("input[name='secret_level2']").attr("checked",false);
		$("input[name='secret_level2']").attr("disabled",true);
		$("#secret_level2").val("");
		$("#secret_level2").removeClass("required");
		$("#secret_level2").parent().prev().html("密级：");
	}
}
$(document).ready(function() {
	controlAccept();
	controlSecret();
});

function setOrgType(){
	$("#org_type_name").text($("#orgtype_name").val());
	$("#org_type_value").val($("#orgtype_value").val());
}


function initTreeValue2_qhh(treeId, treeNode) {
  	//针对单位性质
  	if (( treeNode && treeNode.isParent)) {
		scmWarn("请选择具体的"+$("#" + treeId).attr("label"));
			$("#" + treeId).val("");
			$("#" + treeId).parents("td").find("[name$='" + treeId + "_code'],[id$='" + treeId+ "_code']").val("");
			$("#" + treeId).parents("td").find("[name$='" + treeId + "_value'],[id$='" + treeId+ "_value']").val("");
			$("#" + treeId).parents("td").find("[name$='" + treeId + "_name'],[id$='" + treeId+ "_name']").val("");
			return false;
	}
		var str = treeNode.name;
		var obj = treeNode.parentNode;
		while (obj != null) {
			//str = obj.name + "-" + str;
			obj = obj.parentNode;
		}
		$("#" + treeId).parents("td").find("[name$='" + treeId + "_code'],[id$='" + treeId + "_code']").val(treeNode.id);
		$("#" + treeId).parents("td").find("[name$='" + treeId + "_value'],[id$='" + treeId + "_value']").val(treeNode.id);
		$("#" + treeId).parents("td").find("[name$='" + treeId + "_name'],[id$='" + treeId + "_name']").val(str);
		$("#" + treeId).val(str);
	}

//显示全名称路径
function buildName(treeNode, params){
	var str = treeNode.name;
	var obj = treeNode.parentNode;
	while(obj!=null){
		//str =obj.name+"-"+str;
		obj = obj.parentNode;
	}
	return str;
}


</script>

